home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
binarydb
/
stringmg.bas
< prev
next >
Wrap
BASIC Source File
|
1997-02-19
|
2KB
|
75 lines
Attribute VB_Name = "StringMgmt"
Public Function Parse(ByVal T$, v%) As String
On Error Resume Next
Const DELIMITER = "ñ"
T$ = DELIMITER + Trim(T$) + DELIMITER
xl% = Len(T$)
Place% = 0
For Counter1% = 1 To xl%
CurrentChar$ = Mid$(T$, Counter1%, 1)
If CurrentChar$ = DELIMITER Then Place% = Place% + 1
If Place% = v% Then
xStart% = Counter1% + 1
Exit For
End If
Next
For Counter2% = xStart% To xl%
CurrentChar$ = Mid$(T$, Counter2%, 1)
If CurrentChar$ = DELIMITER Then Place% = Place% + 1
If Place% = v% + 1 Then
xStop% = Counter2% - xStart%
Exit For
End If
Next
If xStop% = 0 Then
Parse = Trim(Mid$(T$, xStart%))
If InStr(Parse, DELIMITER) Then Parse = ""
Else
Parse = Trim(Mid$(T$, xStart%, xStop%))
If InStr(Parse, DELIMITER) Then Parse = ""
End If
On Error GoTo 0
On Error Resume Next
End Function
Public Function ParseTab(ByVal T$, v%) As String
On Error Resume Next
Const DELIMITER = vbTab
T$ = DELIMITER + Trim(T$) + DELIMITER
xl% = Len(T$)
Place% = 0
For Counter1% = 1 To xl%
CurrentChar$ = Mid$(T$, Counter1%, 1)
If CurrentChar$ = DELIMITER Then Place% = Place% + 1
If Place% = v% Then
xStart% = Counter1% + 1
Exit For
End If
Next
For Counter2% = xStart% To xl%
CurrentChar$ = Mid$(T$, Counter2%, 1)
If CurrentChar$ = DELIMITER Then Place% = Place% + 1
If Place% = v% + 1 Then
xStop% = Counter2% - xStart%
Exit For
End If
Next
If xStop% = 0 Then
ParseTab = Trim(Mid$(T$, xStart%))
If InStr(ParseTab, DELIMITER) Then ParseTab = ""
Else
ParseTab = Trim(Mid$(T$, xStart%, xStop%))
If InStr(ParseTab, DELIMITER) Then ParseTab = ""
End If
On Error GoTo 0
On Error Resume Next
End Function